#ifndef SERVERWINDOW_H
#define SERVERWINDOW_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QTimer>
#include <opencv2/opencv.hpp>

QT_BEGIN_NAMESPACE
namespace Ui { class ServerWindow; }
QT_END_NAMESPACE

class ServerWindow : public QMainWindow {
    Q_OBJECT

public:
    ServerWindow(QWidget *parent = nullptr);
    ~ServerWindow();

private slots:
    void startServer();
    void onNewConnection();
    void readSocket();
    void processVideo();
    void toggleSending();
    void processAndSendVideo();

private:
    Ui::ServerWindow *ui;
    QTcpServer *server;
    QTcpSocket *clientSocket;
    QTimer *timer;
    cv::Mat receivedFrame;
    cv::Mat processedFrame;
    bool isSending = false; // Flag to control sending state
};

#endif // SERVERWINDOW_H
